home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 September / 1987-09.d64 / exercise pacer (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  7KB  |  197 lines

  1. 10 rem copyright 1987 compute! publications inc. - all rights reserved
  2. 20 poke53280,11:poke53281,0
  3. 30 printchr$(142)chr$(8)"[147][158]   copyright 1987 compute! pub., inc."
  4. 40 printtab(10)"all rights reserved":print"reading data..."
  5. 50 fori=1to332:reada:x=x+a:next:ifx<>42309thenprint"data statement error.":stop
  6. 60 dimx(201),na$(201),tl$(201):open15,8,15:v=53248:restore
  7. 70 poke54296,15:poke54272,132:poke54273,225:poke54277,0:poke54278,240
  8. 80 poke54279,134:poke54280,33:poke54284,15:poke54285,250
  9. 90 poke54286,106:poke54287,110:poke54291,30:poke54292,0
  10. 100 fors=832to894:readd1:pokes,d1:next:fors=896to958:readd2:pokes,d2:next
  11. 110 poke2040,13:poke2041,14:pokev+29,3:pokev+23,3:pokev+39,4:pokev+40,4
  12. 120 pokev+16,3:pokev+0,20:pokev+2,20:pokev+1,138:pokev+3,138
  13. 130 form=49152to49357:readd3:pokem,d3:next
  14. 140 input"[147]enter time of day (hhmm)";a$:ifval(a$)>1259orlen(a$)<4then140
  15. 150 h1=val(left$(a$,1)):h2=val(mid$(a$,2,1))
  16. 160 m1=val(mid$(a$,3,1)):m2=val(right$(a$,1))
  17. 170 print""left$(a$,2)":"right$(a$,2)
  18. 180 print"is this ok (y/n)?"
  19. 190 getd$:ifd$=""ord$<>"n"andd$<>"y"then190
  20. 200 ifd$="n"then140
  21. 210 poke56331,(h1*16)+h2:poke56330,(m1*16)+m2:poke56329,0:poke56328,0
  22. 220 iffl=1then1320
  23. 230 poke650,128:gosub240:goto310
  24. 240 ln$(1)="[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  25. 250 ln$(2)="    [158][164][164][164][164][164][164]":ln$(3)="    [163][163][163][163][163][163]"
  26. 260 print"[147][150][178]"ln$(1)"[178]";
  27. 270 print"[150][221]            [155]exercise pacer[150]            [221]";
  28. 280 print"[150][177]"ln$(1)"[177]";:return
  29. 290 println$(2):print"   [167][205][164][164][164][164][206][165]":return
  30. 300 print"   [167][206][163][163][163][163][205][180]":println$(3):return
  31. 310 gosub290:print"   [167][167] f1 [165][180]    enter exercises/save":gosub300
  32. 320 gosub290:print"   [167][167] f3 [165][180]    recall program/edit/run":gosub300
  33. 330 gosub290:print"   [167][167] f5 [165][180]    format diskette":gosub300
  34. 340 gosub290:print"   [167][167] f7 [165][180]    exit exercise pacer":gosub300:gosub1710
  35. 350 getd$:ifd$=""then350
  36. 360 d=asc(d$)-132:ifd<1ord>4then350
  37. 370 ondgoto530,890,380,480
  38. 380 print"[147]you have chosen to format a data"
  39. 390 print"diskette. are you sure you want to      do this (y/n)?":gosub1710
  40. 400 getd$:ifd$=""ord$<>"y"andd$<>"n"then400
  41. 410 ifd$="n"then220
  42. 420 print"[147]insert your disk into the disk drive."
  43. 430 print"press _ to start formatting.":gosub1710
  44. 440 getd$:ifd$<>"_"then440
  45. 450 print#15,"n0:exercise data,01"
  46. 460 print"[147][159]...formatting diskette"
  47. 470 gosub1660:goto220
  48. 480 print"[147]you have chosen to exit the program."
  49. 490 print"are you sure you want to do this (y/n)?":gosub1710
  50. 500 getd$:ifd$=""ord$<>"y"andd$<>"n"then500
  51. 510 ifd$="n"then220
  52. 520 close15:print"[147]":end
  53. 530 na$="":print"[147]name of exercise program:":inputna$:ifna$=""then220
  54. 540 iflen(na$)>12then530
  55. 550 print"[147]":nu=1
  56. 560 ifnu=200then660
  57. 570 print"event #"nu"name (enter end[146] to stop):":inputna$(nu)
  58. 580 iflen(na$(nu))>35then570
  59. 590 ifna$(nu)="end"thenna$(nu)="":x=nu-1:goto660
  60. 600 print"[158]time limit for event #"nu"(mmss):":inputtl$(nu)
  61. 610 iflen(tl$(nu))>4then600
  62. 620 print"[154]any mistakes (y/n)?":gosub1710
  63. 630 getd$:ifd$=""ord$<>"y"andd$<>"n"then630
  64. 640 ifd$="y"then570
  65. 650 nu=nu+1:goto560
  66. 660 print"[147]exercise program:"na$:print"number of events:"x
  67. 670 print"insert your data diskette into"
  68. 680 print"the drive.  press _ when ready.":gosub1710
  69. 690 getd$:ifd$<>"_"then690
  70. 700 print"[147][159]...saving data"
  71. 710 open1,8,5,"0:"+na$+",s,w":fornu=1tox:print#1,na$(nu):print#1,tl$(nu):next
  72. 720 print#1:close1:open1,8,5,"0:"+na$+".idx,s,w":print#1,x:print#1:close1
  73. 730 gosub1660:ife<>63then850
  74. 740 print"[147]a file with the same name as[159]"
  75. 750 printna$" exists on the disk."
  76. 760 print"do you wish to replace the old file"
  77. 770 print"with the new (y/n)?":gosub1710
  78. 780 getd$:ifd$=""ord$<>"y"andd$<>"n"then780
  79. 790 ifd$="n"then820
  80. 800 print"[147][159]...erasing old file"
  81. 810 print#15,"s0:"+na$:print#15,"s0:"+na$+".idx":goto700
  82. 820 print"[147]enter new name for program:":gosub1710:inputna$
  83. 830 iflen(na$)>12then820
  84. 840 goto700
  85. 850 print"[147]do you wish to repeat save (y/n)?":gosub1710
  86. 860 getd$:ifd$=""ord$<>"y"andd$<>"n"then860
  87. 870 ifd$="y"then660
  88. 880 ifd$="n"then220
  89. 890 print"[147]place your exercise data diskette"
  90. 900 print"into the disk drive.  enter the"
  91. 910 print"workout program you want to recall.":gosub1710
  92. 920 na$="":inputna$:ifna$=""then220
  93. 930 iflen(na$)>12then920
  94. 940 print"[147][159]...recalling file"
  95. 950 open1,8,5,"0:"+na$+".idx,s,r":input#1,x:close1
  96. 960 open1,8,5,"0:"+na$+",s,r":fornu=1tox:input#1,na$(nu),tl$(nu):next:close1
  97. 970 gosub1660:ife<>0then220
  98. 980 print"[147]press [158]r[146] to run pacer"
  99. 990 print"      [158]e[146] to edit/review program.":gosub1710
  100. 1000 getd$:ifd$=""ord$<>"r"andd$<>"e"then1000
  101. 1010 ifd$="r"then1320
  102. 1020 nu=1
  103. 1030 print"[147][159]program: "na$:print"number of events: "x
  104. 1040 print"event name:":print""na$(nu)
  105. 1050 print"event number:":print""nu
  106. 1060 print"[158]time limit:":print""tl$(nu)
  107. 1070 print"press <f1> to see first event"
  108. 1080 print"press <f3> to see next event"
  109. 1090 print"press <f5> to see previous event"
  110. 1100 print"press <f7> to see last event"
  111. 1110 print"press <a> to add additional events"
  112. 1120 print"press <e> to edit"
  113. 1130 print"[154]press <r> to run pacer"
  114. 1140 print"press <m> to go back to main menu.":gosub1710
  115. 1150 getd$:ifd$=""then1150
  116. 1160 ifd$="[133]"thennu=1:goto1030
  117. 1170 ifd$="[134]"andnu<>400andnu<xthennu=nu+1:goto1030
  118. 1180 ifd$="[135]"andnu<>1thennu=nu-1:goto1030
  119. 1190 ifd$="[136]"thennu=x:goto1030
  120. 1200 ifd$="a"thennu=x+1:goto570
  121. 1210 ifd$="e"then1270
  122. 1220 ifd$="r"andfg=1thenfl=1:fg=0:goto660
  123. 1230 ifd$="m"andfg=1thenfg=0:goto660
  124. 1240 ifd$="r"then1320
  125. 1250 ifd$="m"then220
  126. 1260 goto1150
  127. 1270 fg=1:input"enter new name:";na$(nu)
  128. 1280 iflen(na$(nu))>35then1270
  129. 1290 input"[158]enter new time limit (mmss):";tl$(nu)
  130. 1300 iflen(tl$(nu))>4then1290
  131. 1310 goto1030
  132. 1320 fl=0:fg=0:print"[147]"
  133. 1330 print"     press space bar to start pacer!":d=200:gosub1760
  134. 1340 getd$:ifd$=chr$(32)then1370
  135. 1350 print"     press space bar to start pacer!":d=200:gosub1760
  136. 1360 goto1330
  137. 1370 gosub1740:poke650,0:dm=fre(0):sys49152:fornu=1tox:cg=0
  138. 1380 print"[147][158]time of day: "
  139. 1390 print"[158]exercise:":print" "na$(nu)
  140. 1400 print"[158]event #:"nu:print"[158]events to go:"x-nu
  141. 1410 print"[158]time limit: "mid$(tl$(nu),1,2)":"mid$(tl$(nu),3,2)
  142. 1420 print"[158]time elapsed: ":poke56587,0:poke56586,0:poke56585,0:poke56584,0
  143. 1430 print"[158]up next:":print" [153]"na$(nu+1)
  144. 1440 printspc(9)"[159]press <space> to pause"
  145. 1450 printspc(4)"press <^> to jump to next event"
  146. 1460 printspc(2)"keep pressing <_> to abort exercise"
  147. 1470 gosub1510:gosub1570
  148. 1480 getd$:ifd$="_"thengosub1550:goto220
  149. 1490 ifcg=1thennext:goto1560
  150. 1500 goto1470
  151. 1510 zf=0:forz=1to4:ifpeek(1019+z)-48<>val(mid$(tl$(nu),z,1))thenzf=1
  152. 1520 next:ifzfthenreturn
  153. 1530 gosub1720:cg=1:return
  154. 1540 goto1390
  155. 1550 poke56333,127:poke788,49:poke789,234:poke56333,129:return
  156. 1560 gosub1550:print"[147]              you're done!":gosub1740:goto220
  157. 1570 getd$:ifd$=""thenreturn
  158. 1580 ifd$=chr$(32)then1610
  159. 1590 ifd$="^"thencg=1:return
  160. 1600 return
  161. 1610 poke198,0
  162. 1620 poke56587,0:poke56586,(peek(1020)-48)*16+peek(1021)-48
  163. 1630 poke56585,(peek(1022)-48)*16+peek(1023)-48
  164. 1640 getd$:ifd$<>chr$(32)then1620
  165. 1650 poke56584,0:return
  166. 1660 input#15,e,e$:ife=0thenreturn
  167. 1670 print"[147][159]disk status:":print"[154]number","error":print"[153]"e,e$
  168. 1680 print"press c to continue.":gosub1710
  169. 1690 getd$:ifd$<>"c"then1690
  170. 1700 return
  171. 1710 poke54276,17:d=200:gosub1760:poke54276,16:return
  172. 1720 forr=1to5:poke54283,33:pokev+21,1:d=800:gosub1760
  173. 1730 pokev+21,2:poke54283,32:d=800:gosub1760:next:pokev+21,0:return
  174. 1740 forr=1to40:poke54290,21:d=50:gosub1760:poke54290,20:d=50:gosub1760:next
  175. 1750 return
  176. 1760 fory=1tod:next:return
  177. 1770 data255,255,255,255,255,255,255,255,255,224,0,7,224,60,7,224
  178. 1780 data60,7,226,60,71,225,24,135,224,153,7,224,126